const gulp = require('gulp')
const less = require('gulp-less')
const rename = require('gulp-rename')

const paths = {
    less: ['./**/*.less', '!./node_modules/**', '!./miniprogram_npm/**'],
}

function less2wxss() {
    return gulp.src(paths.less)
        .pipe(less())
        .pipe(rename({
            extname: '.wxss'
        }))
        .pipe(gulp.dest('./'))
}

function watch() {
    gulp.watch(paths.less, less2wxss)
}

exports.default = gulp.series(less2wxss, watch)
